function Dict() {
  this.items = {}

  Dict.prototype.set = function(key, value) {
    return this.items[key] = value
  }

  // 判断字典内是否含有某个key
  Dict.prototype.has = function(key) {
    return this.items.hasOwnProperty(key)
  }

  // 通过key取value, 如果有返回值, 没有返回null
  Dict.prototype.get = function(key) {
    if (!this.has(key)) return null
    return this.items[key]
  }

  // 根据key, 移除整个key-value. 移除成功返回true,否则返回false
  Dict.prototype.remove = function(key) {
    if (!this.has(key)) return false
    delete this.items[key]
    return true
  }
  // claer 置空items
  Dict.prototype.clear = function() {
    this.items = {}
    return true
  }
}

export default Dict